from tabnanny import verbose
from django.db import models


# 省份和市级别数据
class Cov(models.Model):
    update_time = models.DateTimeField(verbose_name='数·据最后更新时间')
    province = models.CharField(verbose_name='省', max_length=50)
    city = models.CharField(verbose_name='市', max_length=50)
    confirm = models.IntegerField(verbose_name='累计确诊')
    confirm_add = models.IntegerField(verbose_name='新增确诊')
    heal = models.IntegerField(verbose_name='累计治愈')
    dead = models.IntegerField(verbose_name='死亡人数')

    class Meta:
        verbose_name_plural = '当前疫情信息表'

    def __str__(self):
        return self.city


class Knowledge(models.Model):
    title = models.CharField(verbose_name='标题', max_length=50)
    text = models.TextField(verbose_name='链接')
    create_time = models.DateTimeField(verbose_name='创建时间', null=True, blank=True)
    class Meta:
        verbose_name_plural = '热点新闻'


# 中国整体数据
class ChinaToal(models.Model):
    update_time = models.DateTimeField(verbose_name='数·据最后更新时间')
    nowConfirm = models.IntegerField(verbose_name='目前确诊')
    heal = models.IntegerField(verbose_name='累计治愈')
    dead = models.IntegerField(verbose_name='累计死亡')

    class Meta:
        ordering = ['-update_time']

# 省份数据
class province_data(models.Model):
    name = models.CharField(verbose_name='省份', max_length=50)
    value = models.IntegerField(verbose_name='目前确诊')
    confirm = models.IntegerField(verbose_name='累计确诊')
    heal = models.IntegerField(verbose_name='累计治愈')
    dead = models.IntegerField(verbose_name='累计死亡')

    class Meta:
        ordering = ['-value', '-confirm']
